<?php
session_start();

if(isset($_POST["register"])){
	include("/class.register.php");
	
	$register = new Register();
	
	if($register->process()){
		echo "Congratulations !! You are now registered.";
	}
	else{
		$register->showErrors();
	}
}

$_SESSION["token"] = $token = md5(uniqid(mt_rand(),true));
?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head><title>Register</title></head>

<body>
<form action="register.php" method="post">
 Username:
 <input type="text" name="ruser" />
 <br><br>
 Paswoord:
 <input type="password" name="rpass" />
 <br><br>
 Rechten:
 <select name="rights">
   <option name="admin">Instructeur</option>
   <option name="unauth">Cursist</option>
 </select>
 <br><br>
 <input type="hidden" name="token" value="<?php echo $token; ?>" />
 <input type="submit" name="register" value="Sign up" />
</form>
<hr />

</body>
</html>